package com.itcam.phaseiii.iostream_;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * Author:Cammy.Wu
 * Date:2024-05-13
 * Description:对象流输入
 */

public class ObjectStream02 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        // 将文件中保存的字符串读入内存
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("E:\\IOStream\\ObjectStream01.txt")));

        // 读取
        String str = (String) (ois.readObject());
        System.out.println(str);

        // 关闭流
        ois.close();
    }
}
